import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '铅封号',
    align: 'center',
    dataIndex: 'id',
  },
  {
    title: '使用单位',
    align: 'center',
    dataIndex: 'inspectionUnit',
  },
  {
    title: '器具名称',
    align: 'center',
    dataIndex: 'meterintruname',
  },
  {
    title: '规格型号',
    align: 'center',
    dataIndex: 'serialnum',
  },
  {
    title: '出厂编号',
    align: 'center',
    dataIndex: 'deviceId_dictText',
  },
  {
    title: '设备编号',
    align: 'center',
    dataIndex: 'deviceId',
    width: 180,
  },
  {
    title: '施封位置',
    align: 'center',
    dataIndex: 'position_dictText',
  },
  {
    title: '铅封状态',
    align: 'center',
    dataIndex: 'claimStatus_dictText',
  },

  {
    title: '领用时间',
    align: 'center',
    dataIndex: 'collectionTime',
  },

  {
    title: '施封日期',
    align: 'center',
    dataIndex: 'sealingTime',
  },
  {
    title: '拆封时间',
    align: 'center',
    dataIndex: 'unsealTime',
  },
  {
    title: '报废时间',
    align: 'center',
    dataIndex: 'scrappedTime',
  },
  {
    title: '报失报损时间',
    align: 'center',
    dataIndex: 'lossTime',
  },
  // {
  //   title: '检定状态',
  //   align: 'center',
  //   dataIndex: 'verificationStatus_dictText',
  // },
  {
    title: '领用人',
    align: 'center',
    dataIndex: 'collectionBy_dictText',
  },

  // {
  //   title: '是否报失报损',
  //   align: 'center',
  //   dataIndex: 'reportLoss_dictText',
  // },
  {
    title: '报失报损人',
    align: 'center',
    dataIndex: 'lossBy',
  },

  // {
  //   title: '是否报废',
  //   align: 'center',
  //   dataIndex: 'scrapped_dictText',
  // },
  {
    title: '报废人',
    align: 'center',
    dataIndex: 'scrappedBy',
  },

  {
    title: '拆封人员',
    align: 'center',
    dataIndex: 'unsealBy',
  },
  {
    title: '拆封原因',
    align: 'center',
    dataIndex: 'unsealReason',
  },
  {
    title: '检定日期',
    align: 'center',
    dataIndex: 'checkDate',
  },
  {
    title: '下次检定日',
    align: 'center',
    dataIndex: 'nextCheckDate',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '铅封号',
    field: 'id',
    component: 'Input',
  },
  {
    label: '铅封状态',
    field: 'claimStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'seal_lead_claim_status',
      placeholder: '请选择铅封状态',
    },
  },
  // {
  //   label: '日期查询',
  //   field: 'createTime_begin',
  //   // field: 'createTime_end',
  //   component: 'RangeDate',
  //   componentProps: {
  //     format: 'YYYY-MM-DD',
  //     valueFormat: 'YYYY-MM-DD',
  //   },
  // },
  // {
  //   label: '检定状态',
  //   field: 'verificationStatus_dictText',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'seal_lead_verification_status',
  //     placeholder: '请选择检定状态',
  //     stringToNumber: true,
  //   },
  // },
  {
    label: '领用人员',
    field: 'collectionBy',
    component: 'JSelectUser',
  },

  {
    label: '施封位置',
    field: 'position',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'seal_position',
      placeholder: '请选择施封位置',
      stringToNumber: true,
    },
  },
  {
    label: '区县查询',
    field: 'region_code',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'xi_an_region_code',
      placeholder: '请选择区县',
      stringToNumber: true,
    },
  },
  {
    label: '领用日期',
    field: 'createTime_begin',
    // field: 'createTime_end',
    component: 'RangeDate',
    componentProps: {
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '出厂编号',
    field: 'deviceId_dictText',
    component: 'Input',
  },
  {
    label: '使用单位',
    field: 'inspectionUnit',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '铅封号',
    field: 'id',
    component: 'Input',
  },
  {
    label: '使用单位',
    field: 'inspectionUnit',
    component: 'Input',
  },
  {
    label: '器具名称',
    field: 'meterintruname',
    component: 'Input',
  },
  {
    label: '规格型号',
    field: 'serialnum',
    component: 'Input',
  },
  {
    label: '出厂编号',
    field: 'deviceId_dictText',
    component: 'Input',
  },
  {
    label: '设备编号',
    field: 'deviceId',
    component: 'Input',
  },
  {
    label: '施封位置',
    field: 'position_dictText',
    component: 'Input',
  },
  {
    label: '铅封状态',
    field: 'claimStatus_dictText',
    component: 'Input',
  },
  {
    label: '领用时间',
    field: 'collectionTime',
    component: 'Input',
  },
  {
    label: '施封日期',
    field: 'sealingTime',
    component: 'Input',
  },
  {
    label: '拆封时间',
    field: 'unsealTime',
    component: 'Input',
  },
  {
    label: '报废时间',
    field: 'scrappedTime',
    component: 'Input',
  },
  {
    label: '报失报损时间',
    field: 'lossTime',
    component: 'Input',
  },
  {
    label: '领用人',
    field: 'collectionBy_dictText',
    component: 'Input',
  },
  {
    label: '报失报损人',
    field: 'lossBy',
    component: 'Input',
  },
  {
    label: '报废人',
    field: 'scrappedBy',
    component: 'Input',
  },
  {
    label: '拆封人员',
    field: 'unsealBy',
    component: 'Input',
  },
  {
    label: '拆封原因',
    field: 'checkDate1',
    component: 'Input',
  },
  {
    label: '检定日期',
    field: 'checkDate',
    component: 'DatePicker',
  },
  {
    label: '下次检定日',
    field: 'nextCheckDate',
    component: 'DatePicker',
    componentProps: {
      //日期格式化，页面上显示的值
      format: 'YYYY-MM-DD',
      //返回值格式化（绑定值的格式）
      valueFormat: 'YYYY-MM-DD',
      //是否显示今天按钮
      showToday: true,
    },
  },

  // {
  //   label: '下次检定日期',
  //   field: 'nextCheckDate',
  //   component: 'DatePicker',
  //   componentProps: {
  //     showTime: true,
  //     valueFormat: 'YYYY-MM-DD HH:mm:ss',
  //   },
  // },

  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  id: { title: '铅封号', order: 1, view: 'text', type: 'string' },
  deviceId_dictText: { title: '出厂编号', order: 2, view: 'text', type: 'string' },
  claimStatus: { title: '领取状态', order: 3, view: 'list', type: 'string', dictCode: 'seal_lead_claim_status' },
  verificationStatus: { title: '检定状态', order: 4, view: 'list', type: 'string', dictCode: 'seal_lead_verification_status' },
  collectionBy: { title: '领用人', order: 5, view: 'text', type: 'string' },
  collectionTime: { title: '领用时间', order: 6, view: 'datetime', type: 'string' },
  inspectionUnit: { title: '送检单位', order: 7, view: 'text', type: 'string' },
  sealingTime: { title: '施封日期', order: 8, view: 'datetime', type: 'string' },
  scrapped: { title: '是否报废', order: 9, view: 'number', type: 'number', dictCode: 'yn' },
  reportLoss: { title: '是否报损', order: 10, view: 'number', type: 'number', dictCode: 'yn' },
  scrappedLossTime: { title: '报损报废时间', order: 11, view: 'datetime', type: 'string' },
  checkDate: { title: '检定日期', order: 12, view: 'datetime', type: 'string' },
  nextCheckDate: { title: '下次检定日期', order: 13, view: 'datetime', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
